﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SchoolChartSynthesize.aspx.cs" Inherits="Web.SchoolChartSynthesize" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>综合统计</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="css/web.css" type="text/css" rel="stylesheet" media="screen" />
    <link href="css/print.css" type="text/css" rel="stylesheet" media="print" />
    <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        var CurrentId = 0;
        var arrayObj = new Array();
        String.prototype.getQuery = function(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = this.substr(this.indexOf("\?") + 1).match(reg);
            if (r != null) return unescape(r[2]); return null;
        }
        $(function() {
            BuildData();
            ShowChart(CurrentId)
        });

        function BuildData() {
            var sid = location.href.getQuery("SchoolId");
            var eid = location.href.getQuery("ExamRoomIds");
            var arr = eid.split("-");
            for (var n = 0; n < 14; n++) {
                var multiplestr = "{sid:'" + sid + "',eid:'" + eid + "',cid:'" + n + "',flag:'multiple'}";
                arrayObj.push(multiplestr);
            }
            for (var n = 0; n < arr.length; n++) {
                var singlestr1 = "{sid:'" + sid + "',eid:'" + arr[n] + "',cid:'14',flag:'single'}";
                var singlestr2 = "{sid:'" + sid + "',eid:'" + arr[n] + "',cid:'15',flag:'single'}";
                var singlestr3 = "{sid:'" + sid + "',eid:'" + arr[n] + "',cid:'16',flag:'single'}";
                var singlestr4 = "{sid:'" + sid + "',eid:'" + arr[n] + "',cid:'17',flag:'single'}";
                arrayObj.push(singlestr1);
                arrayObj.push(singlestr2);
                arrayObj.push(singlestr3);
                arrayObj.push(singlestr4);
            }
        }

        function ShowChart(aid) {
            if (aid < 0) {
                aid = 0;
                alert("向前已经没有数据");
                return;
            }
            if (aid > (arrayObj.length - 1)) {
                aid = arrayObj.length - 1;
                alert("向后已经没有数据");
                return;
            }
            CurrentId = aid;
            $.ajax({
                type: "POST",
                url: "SynthesizeService.asmx/DoViewFeedBack",
                data: arrayObj[aid],
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(message) {
                    var objData = message.d;
                    if (objData == "Over") {
                        alert("报表不存在");
                        return;
                    }
                    if (objData == "False") {
                        alert("参数错觉");
                        return;
                    }
                    if (objData == "Exception") {
                        alert("程序异常");
                        return;
                    }
                    var arrHtml = objData.split("{$ET:SPLIT}");
                    $("#ChartFrame").hide();
                    if (arrHtml[0] == "TableChart") {
                        $("#ChartFrame").attr("src", "Synthesize.aspx?SchoolId=" + location.href.getQuery("SchoolId") + "&ExamRoomIds=" + location.href.getQuery("ExamRoomIds") + "&ChartId=" + CurrentId);
                        $("#ChartFrame").show();
                    }
                    $("#ViewTable").html(arrHtml[1]);
                }
            });
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="head">
	<h1 class="logo"><strong>学科评价报告</strong><em>北京市海淀区义务教育（小学）基础学科</em></h1>
    </div>
    <div id="main">
      <ul class="control">
        <li class="home"><a href="javascript:void(0)" onclick="ShowChart(0)" title="首页">首页</a></li>
        <li class="prev"><a href="javascript:void(0)" onclick="ShowChart(CurrentId-1)"title="上一页">上一页</a></li>
        <li class="next"><a href="javascript:void(0)" onclick="ShowChart(CurrentId+1)" title="下一页">下一页</a></li>
        <li class="end"><a href="javascript:void(0)" onclick="ShowChart(arrayObj.length-1)" title="末页">末页</a></li>
      </ul>
      <ul id="page">
        <li class="every">
          <div class="module-t">
            <h3>综合统计报表</h3>
          </div>
          <div class="module-c">
      	    <ul id="ViewTable"></ul>
            <ul class="module_stat">
              <li>
                <div class="module-c">
                    <iframe id="ChartFrame" src="" frameborder="0" scrolling="no" width="100%" height="320"></iframe>
                </div>
              </li>
            </ul>
          </div>
         </li>
      </ul>
    </div>
    <div id="foot">CopyRight 2011 海淀教育考试培训中心</div>
    </form>
</body>
</html>
